<!--Cell-官方的-->
<template>
  <div class="bg bg2" @click="upClick(item)">

    <!--背景纹路-->
    <LImage :src="config.img('texture2.png')"></LImage>

    <!--图标-->
    <LImage class="image" :src="item.iconUrl"></LImage>

    <!--线-->
    <LImage class="line-image" :src="config.img('strategy_divider.png')"></LImage>

    <!--信息-->
    <div class="column">
      <div class="row acenter">
        <text class="font32 text1 text-name">{{T(T(item.strategyName))}}</text>
        <!-- <div class="num bk1" @click="numClick(item)">
          <LImage class="num-image" :src="config.img('strategy_peoplex.png')"></LImage>
          <text class="font20 text3">{{item.chooseNumber}}</text>
        </div> -->
        <LImage v-if="item.strategyType == 'member'" 
        class="up-vip" :src="config.img('up_vip.png')"></LImage>
      </div>
      
      <div class="height18"></div>
      <div class="row">
        <text class="font24 text3 text">{{T(item.introduce)}}</text>
        <LImage class="cellof-arrow" :src="config.img('strategy_arrowx.png')"></LImage>
      </div>
    </div>

    <!--类型-->
    <div :class="['type', item.type == 'contract' ? 'type-hong' : '']">
      <text :class="['font22', item.type == 'contract' ? 'udRed-t1' : 'main-t1']">{{item.type == 'contract' ? T('合约') : T('币币')}}</text>
    </div>
  </div>
</template>

<script>

//功能
import navigator from "@/_js/navigator"; 
import math from "@/_js/math";
import config from "@/_js/config";
import modal from "@/_js/modal";

const weexFunction = weex.requireModule("WeexFunction");

import I18N from "@/_i18n/i18n";
var T = I18N.t;

export default {

  props:{
    item: JSON, //策略信息
    isVip:{ //true会员 false非会员
      type:Boolean,
      default: false,
    },
  },
  
  data() {
    return {
      T:T,
      config:config,
    };
  },

  mounted(){
    item.chooseNumber = math.guiFan(item.chooseNumber, 2);
  },

  methods:{

    /********************************** 点击触发*/
    //启动
    upClick(item){

      if (!config.forceLogin()) {
        return;
      }

      if (item.strategyType == 'member' && !this.isVip) {

        
        var parm = {title:T("提示"),
                    message:T("VIP策略，请先开通VIP会员再启动。"),
                    okBtn:T("前往"), cancelBtn:T("取消")};
        modal.confirm(parm, (bool)=>{
          if (bool == "true") {
            navigator.open('', "mine/Vip", {}, {'navColor':'#1677fe'});
          }
        });
        return;
      }
  
      var param = {'strategyId':item.strategyId, 'strategyName':T(item.strategyName)};

      var strategyName = T(item.strategyName);

      /*合约*/
      if (item.type == 'contract') { //合约
        navigator.open(strategyName, 'upContract/CUp', param);
      } 
      
      /*币币*/
      else  if (item.strategyName == '网格交易') {
        navigator.open(strategyName, 'up/SUpGrid', param);
      } else if (item.strategyName == '海浪网格') {
        navigator.open(strategyName, 'up/SUpSea', param);
      } else if (item.strategyName == '马丁追踪') {
        navigator.open(strategyName, 'up/SUpMd', param);
      } else if (item.strategyName == '区间套利') { 
        navigator.open(strategyName, 'up/SUpQj', param);
      } else if (item.strategyName == '恒量定投') {
        navigator.open(strategyName, 'up/SUpWeigh', param);
      } else if (item.strategyName == '海风马丁') {
        navigator.open(strategyName, 'up/SUpHf', param);
      } else if (item.strategyName == '币本位海风马丁') {
        navigator.open(strategyName, 'up/SUpHfTb', param);
      } else {
        navigator.open(strategyName, 'up/SUpTy', param);
      }
    },

    //数量点击
    numClick(item) {
      var str = T('在线执行中') + ':' + item.chooseNumber;
      modal.alert(str);
    },
  }
}
</script>


<style src="@/_css/style.css"></style>
<style scoped>
.bg{
  flex-direction: row;
  align-items: center;
  height: 200px;
  border-radius: 16px;
}
.image{
  width:80px;
  height:80px;
  margin-left: 40px;
}
.line-image {
  width:10px;
  height:146px;
  margin-left: 40px;
  margin-right: 34px;
}
.num{
  flex-direction: row;
  justify-content: center;
  align-items: center;
  height:28px;
  padding-left: 8px;
  padding-right: 14px;

  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border-bottom-right-radius: 28px;
  border-width: 2px;

  margin-left: 20px;
}
.num-image{
  width: 20px;
  height: 20px; 
  margin-right: 8px;
}
.up-vip {
  width: 60px;
  height: 32px;
  margin-left: 10px;
}
.text-name {
  max-width:400px;
  line-height:34px;
  lines:2;
  text-overflow: ellipsis;
}
.text {
  width:350px;
  line-height:34px;
  lines:2;
  text-overflow: ellipsis;
}
.type{
  position: absolute;
  flex-direction: row;
  align-items: center;
  height: 32px;
  padding-left: 10px;
  padding-right: 10px;
  border-top-right-radius: 16px;
  border-bottom-left-radius: 8px;


  background-color: rgba(22, 119, 254, 0.1);

  top: 0;
  right: 0;
}
.type-hong{
  background-color: rgba(252, 97, 128, 0.1);
}

/*********************** 间距*/
.height18{
  height: 18px;
}
</style>
